Component({
  properties: {
    acupoint: {
      type: Object,
      value: null,
      observer: function(newVal, oldVal) {
        console.log('acupoint property observer 被调用')
        console.log('新值:', newVal)
        console.log('新值类型:', typeof newVal)
        
        if (newVal && newVal.id) {
          console.log('acupoint property 数据有效，ID:', newVal.id)
        } else {
          console.warn('acupoint property 数据无效:', newVal)
        }
      }
    }
  },
  
  // 声明组件要触发的事件
  options: {
    addGlobalClass: true
  },
  
  observers: {
    'acupoint': function(acupoint) {
      console.log('acupoint-card observers 接收到的数据:', acupoint)
      
      if (!acupoint || !acupoint.id) {
        console.warn('acupoint-card observers 数据无效:', acupoint)
      } else {
        console.log('acupoint-card observers 数据有效，ID:', acupoint.id)
      }
    }
  },
  
  methods: {
    onTap() {
      console.log('acupoint-card 被点击')
      console.log('当前穴位数据:', this.data.acupoint)
      console.log('穴位数据类型:', typeof this.data.acupoint)
      console.log('穴位数据ID:', this.data.acupoint ? this.data.acupoint.id : 'undefined')
      
      if (!this.data.acupoint || !this.data.acupoint.id) {
        console.error('穴位数据无效:', this.data.acupoint)
        console.error('数据详情:', JSON.stringify(this.data.acupoint))
        return
      }
      
      console.log('准备触发tap事件，穴位ID:', this.data.acupoint.id)
      
      // 触发自定义事件，将穴位数据传递给父组件
      this.triggerEvent('tap', {
        acupoint: this.data.acupoint
      }, {
        bubbles: true,
        composed: true
      })
      
      console.log('tap事件已触发')
    }
  }
})
